/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.drypisy;

import java.awt.Point;
import java.util.Vector;

/**
 *
 * @author Marcin Piłat
 */
public class WarpMemento {
    private Vector<Point> startPoints = new Vector<Point>();
    private Vector<Point> endPoints = new Vector<Point>();
    private Vector<Integer> rads = new Vector<Integer>();
    
    public int getSize(){
        return startPoints.size();
    }
    
    public void addPoints(int x1, int y1, int x2, int y2, int r){
        startPoints.add(new Point(x1, y1));
        endPoints.add(new Point(x2, y2));
        rads.add(r);
    }
    
    public Point getSPoint(int i){
        Point p = startPoints.elementAt(i);
        return p;
    }
    
    public Point getEPoint(int i){
        Point p = endPoints.elementAt(i);
        return p;
    }
    
    public int getRad(int i){
        Integer r = rads.elementAt(i);
        return r;
    }
    
    public void countProp(double p){
        for(int i = 0 ; i < rads.size() ; ++i){
            Point s = startPoints.get(i);
            startPoints.elementAt(i).move((int)(s.x*p),(int) (s.y*p));
            Point e = endPoints.get(i);
            endPoints.elementAt(i).move((int)(e.x*p),(int)(e.y*p));
            Integer r = rads.get(i);
            rads.remove(r);
            r = new Integer((int)(r*p));
            rads.insertElementAt(r, i);
        }
    }
    
    public void removeLast(){
        startPoints.remove(startPoints.lastElement());
        endPoints.remove(endPoints.lastElement());
        rads.remove(rads.lastElement());
    }
    
}
